//#include <iostream>
//#include <string>
//#include <sstream>
//using namespace std;
//template <class T>
//T tonumber(string strNum)
//{
//	T num = 0;
//	stringstream ss;
//	ss << strNum;
//	ss >> num;
//	return static_cast <T> (num);
//}
//int main()
//{
//	/*auto num = tonumber<int>("123");
//	cout << "type " << typeid(num).name() << " : " << num << endl;*/
//
//	string s("hello World");
//	cout << tolower(s[6]) << endl;
//}

#include <iostream>
#include <string>
using namespace std;
class Solution{
public:
    int firstUniqChar(string s)
    {
        int a[256] = { 0 };
        for (int i = 0; i < s.size(); i++)
        {
            a[s[i]] += 1;
       }
        for (int i = 0; i < s.size(); i++)
        {
            if (1 == a[s[i]])
            {
                return i;
            }
        }
        return -1;
    }
};

int main()
{
    Solution s1;
    int ret = s1.firstUniqChar("leetcode");

    cout << ret << endl;
}